<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

  <style>
    .demo a{
      float:left;
      display: block;
      width: 50px;
      height: 50px;
      border-radius: 10px;
      background: blue;
      text-align: center;
      color: yellow;
      text-decoration: none;
      margin-right: 5px;
      font: bold 20px/50px Arial;
    }
    /*a[]{}可以限定含有条件指定的标签进行改变
    单独包含属性，不赋值，就是改变所有包含该属性的标签
    属性名=属性值（正则表达式），必须符合属性值的才改变
    "=" 绝对等于，必须完全满足
    */
    a[id="last"]{
      background: red;
    }
    /*"*=" 包含等于*/
    a[class="links item"]{
      background: green;
    }
    /*^= 属性值以http开头*/
    a[href^=http]{
      background: black;
    }
    /*$= 属性值以doc结尾*/
    a[href$=doc]{
      background: cornsilk;
    }
  </style>

</head>
<body>

<p class="demo">
  <a href="https://www.baidu.com" class="links item first" id="first">1</a>
  <a href="" class="links item active" target="_blank" title="test">2</a>
  <a href="image/123.html" class="links item">3</a>
  <a href="image/123.png" class="links item">4</a>
  <a href="image/123.jpg" class="links item">5</a>
  <a href="abc" class="links item">6</a>
  <a href="/a.pdf" class="links item">7</a>
  <a href="/abc.pdf" class="links item">8</a>
  <a href="abc.doc" class="links item">9</a>
  <a href="abcd.doc" class="links item last" id="last">10</a>
</p>

</body>
</html>